import { Router } from 'express';
import { ArticleController } from '../controllers/articleController';

const router = Router();
const articleController = new ArticleController();

// === 用户端接口（无需认证） ===

// 获取文章列表
router.get('/', articleController.getArticles.bind(articleController));

// 获取文章统计
router.get('/stats', articleController.getArticleStats.bind(articleController));

// 获取推荐文章
router.get('/recommend', articleController.getRecommendArticles.bind(articleController));

// 获取置顶文章
router.get('/top', articleController.getTopArticles.bind(articleController));

// 根据slug获取文章详情
router.get('/slug/:slug', articleController.getArticleBySlug.bind(articleController));

// 根据ID获取文章详情
router.get('/:id', articleController.getArticleById.bind(articleController));

export default router; 